package com.brainhealth.common.enums;

import org.apache.commons.lang3.StringUtils;

import java.util.ArrayList;
import java.util.List;

/**
 * @author wll
 * <p>
 * 下一条聊天内容标识
 */
public enum ChatIdEnum {

    NUMBER("NUMBER", "数字"),
    BASE("BASE", "基础信息"),
    DATE("DATE", "日期打招呼"),
    COMPLETED("COMPLETED", "已训练次数"),
    REMIND("REMIND", "剩余训练次数"),
    REPORT("REPORT", "报告"),
    AFTER_REPORT("AFTER_REPORT", "报告后"),
    KNOWLEDGE("KNOWLEDGE", "知识分享"),
    RETURN_KNOWLEDGE("RETURN_KNOWLEDGE", "返回知识分享"),
    RETURN_BEGIN("RETURN_BEGIN", "返回青竹"),
    CHAT_NEXT("CHAT_NEXT", "下一聊天"),
    RETURN_END("RETURN_END", "欢迎回来结束"),
    RETURN_BASE("RETURN_BASE", "基础信息欢迎回来"),
    AFTER_ASK_MOOD("AFTER_ASK_MOOD", "询问心情后");

    String chatFlag;
    String desc;

    ChatIdEnum(String chatFlag, String desc) {
        this.chatFlag = chatFlag;
        this.desc = desc;
    }

    public String getChatFlag() {
        return chatFlag;
    }

    public static boolean checkCheckId(String checkId) {
        if (StringUtils.isBlank(checkId))
            return false;
        List chatFlagList = new ArrayList<String>(ChatIdEnum.values().length);
        for (ChatIdEnum chatIdEnum : ChatIdEnum.values()) {
            chatFlagList.add(chatIdEnum.chatFlag);
        }
        if (chatFlagList.contains(checkId)) {
            return true;
        }
        try {
            if (Long.valueOf(checkId) > 0) {
                return true;
            }
        } catch (Exception e) {

        }
        return false;
    }
}
